package com.roadjava;

import com.roadjava.beans.dto.CarDTO;
import com.roadjava.beans.dto.DriverDTO;
import com.roadjava.beans.dto.PartDTO;

import java.util.ArrayList;
import java.util.Date;

public class Builder {
    public static CarDTO buildCarDTO() {
        // 零件
        PartDTO partDTO1 = new PartDTO();
        partDTO1.setPartId(1L);
        partDTO1.setPartName("多功能方向盘");
        PartDTO partDTO2 = new PartDTO();
        partDTO2.setPartId(2L);
        partDTO2.setPartName("智能车门");

        ArrayList<PartDTO> partDTOList = new ArrayList<>();
        partDTOList.add(partDTO1);
        partDTOList.add(partDTO2);

        // 驾驶员
        DriverDTO driverDTO = new DriverDTO();
        driverDTO.setId(1L);
        driverDTO.setName("张三");

        CarDTO carDTO = new CarDTO();
        carDTO.setId(1L);
        carDTO.setVin("vin");
        carDTO.setPrice(1000.12345d);
        carDTO.setTotalPrice(2000.12345d);
        carDTO.setPublishDate(new Date());
        carDTO.setBrand("大众");
        carDTO.setPartDTOS(partDTOList);
        carDTO.setDriverDTO(driverDTO);

        return carDTO;
    }
}
